package com.woniu.adopt.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniu.adopt.entity.UserLogLogin;
import com.woniu.adopt.mapper.UserLogLoginMapper;
import com.woniu.adopt.vo.UserLogLoginVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LogLoginService {
    @Autowired
    UserLogLoginMapper userLogLoginMapper;

    public PageInfo<UserLogLoginVo> queryUserByPage(Integer now, Integer size, String name) {
        PageHelper.startPage(now, size).setOrderBy("l.logintime desc");
        List<UserLogLoginVo> userLogLogins = userLogLoginMapper.selectByCondition(name);
        return new PageInfo<>(userLogLogins);
    }

    public List<UserLogLoginVo> queryAll() {
        return userLogLoginMapper.selectByCondition(null);
    }
}
